home *** CD-ROM | disk | FTP | other *** search
/ Adobe Graphics & Publishing SDK 1996 December / Adobe Graphics & Publishing SDK 1996 December.iso / mac / PageMaker 6.5 SDK Mac / SourceCode / CW memory files / NewWithFree.cp < prev    next >
Encoding:
Text File  |  1995-04-28  |  1.2 KB  |  49 lines  |  [TEXT/CWIE]

  1. #include "NewWithFree.h"
  2.  
  3. #include <New.cp>
  4.  
  5.  
  6. #if NEWMODE==NEWMODE_NORMAL
  7. /************************************************************************/
  8. /*    void FreeAllCplusMemory(void)                                        */
  9. /*    Purpose..:     Dispose all memory                                        */
  10. /*    Input....:    ---                */
  11. /*    Return...:    ---                                                        */
  12. /************************************************************************/
  13. void FreeAllCplusMemory(void)
  14. {
  15.     FreeMemList    *temp;
  16.  
  17.     while (memlist.next)
  18.     {
  19.         temp = (memlist.next)->next;
  20.         if (GetPtrSize((Ptr)(memlist.next)))  // it's a "real" Ptr
  21.             DisposePtr((Ptr)(memlist.next));
  22.         memlist.next = temp;
  23.     }
  24.     memlist.size = 0;         // reinitialize memlist
  25. }
  26. #elif NEWMODE==NEWMODE_FAST
  27. /************************************************************************/
  28. /*    void FreeAllCplusMemory(void)                                        */
  29. /*    Purpose..:     Dispose all memory                                        */
  30. /*    Input....:    ---                */
  31. /*    Return...:    ---                                                        */
  32. /************************************************************************/
  33. void FreeAllCplusMemory(void)
  34. {
  35.     MemPool    *temp;
  36.  
  37.     while (mempools)
  38.     {
  39.         temp = mempools->next;
  40.         DisposePtr((Ptr)mempools);
  41.         mempools = temp;
  42.     }
  43.     lastfree = NULL;        //    pointer to last free block
  44.     lastend = NULL;            //    pointer to last end
  45.     
  46. }
  47. #endif
  48.  
  49.